package com.example.springbook.dao;

import com.example.springbook.bean.Admin;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AdminDao {

    @Insert("insert into admin(id, name, tel, pwd) values (#{id}, #{name}, #{tel}, #{pwd})")
    void addAdmin(Admin admin);

    @Update("update admin set name=#{name}, tel=#{tel}, pwd=#{pwd}")
    void updateAdmin(Admin admin);

    @Delete("delete from admin where id=#{id}")
    void deleteAdmin(int id);

    @Select("select name from admin where id=#{id}")
    String findAdminName(int id);

    @Select("select pwd from admin where id=#{id}")
    String selectAdmin(int id);

    @Select("select id, name, tel, pwd FROM admin")
    List<Admin> findAll();
}
